$(function () {
    var getcodeBtn = $('#getcode')
    var LIMITTIME = 60
    var second = LIMITTIME
    var flag = true
    var timeDown = function () {
        if (second > 0) {
            getcodeBtn
                .removeClass('bg-danger')
                .css({
                    'background': '#999',
                    'cursor': 'not-allowed',
                    'font-size': '12px'
                })
                .html(second + ' 秒后重新获取')
            flag = false
            var timer = setTimeout(function () {
                second--
                timeDown()
            }, 1000)
        } else {
            clearInterval(timer)
            getcodeBtn
                .css({
                    'background': '#bb401f',
                    'cursor': 'pointer',
                    'font-size': '12px'
                })
                .html('重新获取验证码')
            second = LIMITTIME
            flag = true
        }
    };

    // 点击获取验证码按钮
    getcodeBtn.on('click', function () {
        if (!flag) return
        timeDown()
        console.log($('#phone').val())

    })

    $('#fabu').on('click', function () {
        console.log(222222222)
    })
})
